package com.spic.system.service.impl;

import com.spic.system.mapper.SysDeptMapper;
import com.spic.system.mapper.SysRoleDeptMapper;
import com.spic.system.service.BusinessDataScopeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description 数据权限查询接口(数据库实现)
 * @Author AnQi
 * @Date 2021/11/28
 */
@Service
public class BusinessDataScopeDBServiceImpl implements BusinessDataScopeService {

    @Autowired
    private SysRoleDeptMapper roleDeptMapper;
    @Autowired
    private SysDeptMapper deptMapper;

    @Override
    public List<Long> customDeptIds(Long roleId) {
        return roleDeptMapper.selectByRoleId(roleId);
    }

    @Override
    public List<Long> deptAndChildrenIds(Long deptId) {
        return deptMapper.selectDeptAndChildrenIds(deptId);
    }
}
